#ifndef LOGINDIALOG_H
#define LOGINDIALOG_H

#include "sqloperator.h"

#include <QDialog>
#include <QMessageBox>

namespace Ui {
class LoginDialog;
}

class LoginDialog : public QDialog
{
    Q_OBJECT

public:
    explicit LoginDialog(SqlOperator *dbOperator, QWidget *parent = nullptr);
    ~LoginDialog();

private:
    SqlOperator *m_dbOperator;
    QString m_userRole; // 存储用户角色(工号前缀判断)
    QString m_employeeId; // 存储当前登录员工ID

private slots:
    void on_loginButton_clicked();
    void on_exitButton_clicked();

public:
    QString getUserRole() const; // 获取用户角色
    QString getEmployeeId() const; // 获取当前登录员工ID

private:
    Ui::LoginDialog *ui;
    bool validateUser(const QString &username, const QString &password);
};

#endif // LOGINDIALOG_H
